package com.etc.log;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Component;

@Aspect
@Component
@EnableAspectJAutoProxy(proxyTargetClass=true)
public class LogAop {

	@Pointcut(value = "execution(* com.etc.service.*.*(..))")
	public void test() {
	}

	@Before(value = "test()")
	public void before() {
		System.out.println("**************before通知**************");
	}

	@After(value = "test()")
	public void after() {
		System.out.println("**************after通知**************");
	}

	@Around(value = "test()")
	public Object around(ProceedingJoinPoint pjp) throws Throwable {
		System.out.println("**************around before通知**************");
		Object obj = pjp.proceed();
		System.out.println("**************around after通知**************");

		return obj;
	}

}
